//
//  MPPlayViewController.m
//  QuicklyPlay
//
//  Created by 你的温柔是我唯一沉溺 on 15/11/16.
//  Copyright © 2015年 OPteam. All rights reserved.
//

#import "MPPlayViewController.h"

@interface MPPlayViewController ()

@end

@implementation MPPlayViewController





- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    [self.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
    
    
    
    
    self.view.transform = CGAffineTransformMakeRotation(M_PI / 2);
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
    
    
    
    
    self.moviePlayer.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
    
    self.moviePlayer.shouldAutoplay = YES;
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:self.moviePlayer];
}



-(void)movieFinished:(NSNotification *)notify {
    MPMoviePlayerController *movieVC = [notify object];
    [[NSNotificationCenter defaultCenter]removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:movieVC];
    
    
        [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
    
    
    [self dismissViewControllerAnimated:NO completion:nil];

    
}


//-(UIInterfaceOrientationMask)supportedInterfaceOrientations{
//    return UIInterfaceOrientationMaskLandscapeRight;
//}
//
//-(BOOL)shouldAutorotate {
//    return YES;
//}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];


    
    
    


}



@end
